package ch.hearc.infrarouge.models;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;

/**
 * Infrarouge thread inside a forum.
 * 
 * @author Nils Amiet
 * 
 */
public class ForumThread {
	private int id;
	private String title;
	private String url;
	private Forum forum;
	private User author;

	public ForumThread() {

	}

	public ForumThread(String title, String url, Forum forum, User author) {
		try {
			this.title = URLDecoder.decode(title, "utf-8");
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		}
		this.url = url;
		this.forum = forum;
		this.author = author;
	}

	@Override
	public String toString() {
		return this.title + "\n" + this.url + "\n";
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public Forum getForum() {
		return forum;
	}

	public void setForum(Forum forum) {
		this.forum = forum;
	}

	public User getAuthor() {
		return author;
	}

	public void setAuthor(User author) {
		this.author = author;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

}
